<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="../day53/jquery-3.6.0.min.js"></script>
</head>
<body>
    <p>
        全选: <input type="checkbox" name="" id="" class="check-all">
    </p>
    <p>
        单选: <input type="checkbox" name="" id="" class="check-one">
        <input type="checkbox" name="" id="" class="check-one">
        <input type="checkbox" name="" id="" class="check-one">
        <input type="checkbox" name="" id="" class="check-one">
        <input type="checkbox" name="" id="" class="check-one">
        <input type="checkbox" name="" id="" class="check-one">
    </p>
</body>
<script>
    $(".check-all").click(function(){
        var status = $(this).prop("checked");
        $(".check-one").prop("checked", status)
    })
    $(".check-one").click(function(){
        // var flag = $(".check-one").length == $(".check-one:checked").length ? true : false;
        // $(".check-all").prop("checked",flag);
        var flag = $(".check-one").is(":not(:checked)");
        $(".check-all").prop("checked",!flag);
    })
</script>
</html>